package nicg.st.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.google.protobuf.InvalidProtocolBufferException;

//import nicg.st.Communicate;
import nicg.st.service.TargetService;


@RestController
public class TargetController {

    @Autowired
    private TargetService targetService;
//    Communicate communicate = Communicate.getSingleton();
  //处理请求地址映射的注解 
    @RequestMapping(value = "/api/get_tar/{targetNum}", method = RequestMethod.GET)
    public byte[] findPBCityByte(@PathVariable long targetNum) throws InvalidProtocolBufferException {
        return targetService.findPBTargetByteByNum(targetNum);
    }
    
    @RequestMapping(value = "/api/search_tars", method = RequestMethod.POST)
    public byte[] findPBTargetByteByArea(@RequestBody byte[] input) throws InvalidProtocolBufferException { 	
    	System.out.println(input+"   ttttttt111111111111111111111111111111    "+ input.length);    	
        return targetService.findPBTargetByArea(input);
    }
    

 }
